package com.zlj.myselfrule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: 修改 / 自定义 Ribbon 负载均衡策略
 * @Author: zlj
 * @CreateDate: 2018/6/22 9:56
 * @Version: 1.0.0
 */
@Configuration
public class MySelfRule {

    @Bean
    public IRule getIRule() {
        /**
         * 修改Ribbon 负载均衡策略
         */
        //return new RandomRule();   //默认轮询，自定义为随机

        /**
         * 自定义 Ribbon 负载均衡策略
         */
        return new MyRandomRule();
    }
}
